package com.hygj.service.impl;

import com.hygj.baseUtil.BaseDao;
import com.hygj.baseUtil.BaseServiceImpl;
import com.hygj.pojo.Auth;
import com.hygj.pojo.User;
import com.hygj.service.AuthService;
import com.hygj.service.RoleAuthService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class AuthServiceImpl extends BaseServiceImpl<Auth> implements AuthService {

	@Resource
	private RoleAuthService roleAuthService;


	@Resource(name = "authDao")
	@Override
	public void setDao(BaseDao<Auth> dao) {
		// TODO Auto-generated method stub
		super.setDao(dao);
	}

	@Override
	public void delete(Integer[] ids) {
		Map<String, Object> params = new HashMap<String, Object>();
		if(ids.length > 0){
			for(Integer authId: ids){
				//给userMapper 传id值  通过 params
				params.put("authId", authId);
				//roleAuthService.delete("delete",authId);
				delete("delete",authId);

			}

		}

	}

	@Override
	public List<Auth> selectAuths(Integer authId) {
	   Map<String, Object> params = new HashMap<String, Object>();
		params.put("authId", authId);
		return (List<Auth>) find("find",params);
	}


}
